package com.example.lenovo.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private List<pep> pepList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initpeps();
        WechatAdapter adapter = new WechatAdapter(MainActivity.this, R.layout.wechat_item, pepList);
        ListView listView = (ListView) findViewById(R.id.list_wechat);
        listView.setAdapter(adapter);
    }

    private void initpeps() {
        for(int i = 0; i < 10; i++) {
            pep peps1 = new pep("用户1" + i, R.mipmap.profile_pressed);
            pep peps2 = new pep("用户2" + i, R.mipmap.profile_normal);
            pepList.add(peps1);
            pepList.add(peps2);
        }
    }
}
